<template>
  <div class="shopInfo" :style="outModuleCss">
    <div :style="moduleBgCss" class="module-bg"></div>
    <div class="shopInfoContent">
      <div class="title" v-if="propsData.params.useTitle == 1">
        <moduleHeader
          :propsData="propsData"
          :moduleName="propsData.params.text"
          @editModuleHeader="editModuleHeader"
        ></moduleHeader>
      </div>
      <div class="shopList">
        <template v-for="item in 4">
          <div class="shopItem1" v-if="propsData.params.style == 1" :key="item">
            <div class="pic">
              <img src="@/assets/images/diy/shop_good_pic.png" alt="" />
            </div>
            <div class="shopDetail">
              <p class="shopName">黄焖鸡米饭(宝龙店)</p>
              <div class="score">
                <div class="info">
                  <div class="star">
                    <img src="@/assets/images/diy/shop_star.png" alt="" />
                    <span>5.0分</span>
                  </div>
                  <div class="count">月售895</div>
                </div>
                <span class="distance">距你2.4km</span>
              </div>
              <div class="contect">
                <div class="phone">
                  <img src="@/assets/images/diy/shop_phone.png" alt="" />
                  <span>18638822150</span>
                </div>
                <div class="location">
                  <img
                    src="@/assets/images/diy/shop_location.png"
                    alt=""
                  />
                  <span>导航</span>
                </div>
              </div>
            </div>
          </div>
          <div class="shopItem2" v-if="propsData.params.style == 2" :key="item">
            <div class="pic">
              <img src="@/assets/images/diy/shop_good_pic.png" alt="" />
            </div>
            <div class="shopDetail">
              <span class="shopName">黄焖鸡米饭(宝龙广场)</span>
              <div class="score">
                <div class="info">
                  <div class="star">
                    <img src="@/assets/images/diy/shop_star.png" alt="" />
                    <span>5.0分</span>
                  </div>
                  <span class="line"></span>
                  <div class="count">月售895</div>
                </div>
                <span class="distance">2.4km</span>
              </div>
              <div class="phone">
                <img src="@/assets/images/diy/shop_phone.png" alt="" />
                <span>18638822150</span>
              </div>
              <div class="location">
                <img src="@/assets/images/diy/shop_location.png" alt="" />
                <span>立即导航</span>
              </div>
            </div>
          </div>
        </template>
      </div>
    </div>
  </div>
</template>

<script>
import { mixinsModuleCss } from "@/components/DiyNew/diy/mixins/index.js";
import moduleHeader from "@/components/DiyNew/diy/baseControl/moduleHeader/index.vue";

export default {
  name: "shopInfo",
  props: {
    propsData: {
      type: Object,
      default: {},
    },
  },
  mixins: [mixinsModuleCss],
  components: {
    moduleHeader,
  },
  data() {
    return {};
  },
  methods: {
    editModuleHeader(e) {
      this.$emit("chooseMoudle", e);
    },
  },
};
</script>

<style lang="scss" scoped>
.shopInfo {
  position: relative;
  .shopInfoContent {
    width: 100%;
    padding: 12px 12px 0 12px;
  }
  .module-bg {
    width: 100%;
    height: 100%;
    z-index: -1;
    position: absolute;
    left: 0;
    top: 0;
  }
  .title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
  }
  .shopList {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding-bottom: 12px;
    .shopItem1 {
      background-color: #fff;
      width: 100%;
      display: flex;
      padding: 12px;
      border-radius: 5px;
      margin-bottom: 10px;
      .pic {
        width: 82px;
        min-width: 82px;
        height: 82px;
        border-radius: 5px;
        overflow: hidden;
        img {
          width: 100%;
          height: 100%;
          object-fit: cover;
        }
      }
      .shopDetail {
        flex: auto;
        display: flex;
        flex-direction: column;
        width: 0;
        margin-left: 12px;
        .shopName {
          width: 100%;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
          font-size: 16px;
          font-weight: bold;
          margin-bottom: 0;
        }
        .score {
          display: flex;
          align-items: center;
          justify-content: space-between;
          margin: 8px 0;
          .info {
            display: flex;
            align-items: center;
            font-size: 12px;
            .star {
              display: flex;
              align-items: center;
              color: #ff7010;
              img {
                width: 12px;
                height: 12px;
                margin-right: 2px;
              }
            }
            .count {
              color: #9b9b9b;
              margin-left: 6px;
            }
          }
          .distance {
            font-size: 12px;
            color: #9b9b9b;
          }
        }
        .contect {
          display: flex;
          align-items: center;
          justify-content: space-between;
          font-size: 12px;
          color: #9b9b9b;
          .phone,
          .location {
            display: flex;
            align-items: center;
          }
          img {
            width: 12px;
            height: 12px;
            margin-right: 2px;
          }
          .location {
            img {
              width: 11px;
              height: 13px;
            }
          }
        }
      }
    }
    .shopItem1:last-child {
      margin-bottom: 0;
    }
    .shopItem2 {
      width: 49%;
      border-radius: 5px;
      overflow: hidden;
      margin-bottom: 10px;
      .pic {
        width: 100%;
        height: 170px;
        background-color: #f2f2f2;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .shopDetail {
        width: 100%;
        padding: 10px;
        background-color: #fff;
        display: flex;
        flex-direction: column;
        .shopName {
          font-size: 14px;
          font-weight: bold;
          width: 100%;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
        .score {
          display: flex;
          align-items: center;
          justify-content: space-between;
          font-size: 12px;
          color: #9b9b9b;
          margin: 5px 0;
          .info {
            display: flex;
            align-items: center;
            .star {
              display: flex;
              align-items: center;
              color: #ff7010;
              img {
                width: 12px;
                height: 12px;
              }
            }
            .line {
              width: 1px;
              height: 10px;
              background-color: #9b9b9b;
              margin: 0 6px;
            }
          }
        }
        .phone {
          display: flex;
          align-items: center;
          font-size: 12px;
          color: #9b9b9b;
          img {
            width: 12px;
            height: 12px;
            margin-right: 2px;
          }
        }
        .location {
          display: flex;
          align-items: center;
          justify-content: center;
          font-size: 12px;
          color: #9b9b9b;
          margin-top: 10px;
          img {
            width: 11px;
            height: 13px;
          }
        }
      }
    }
  }
}
</style>